]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Make OSK follow gesture progress
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 11 Feb 2021 23:54:55 +0000 (00:54 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 17 Feb 2021 15:45:01 +0000 (15:45 +0000)
With all other gestures offering live feedback of progress, seems
to make sense to update the "swipe from bottom edge to show OSK"
gesture as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668>

js/ui/keyboard.js

index ae3cdd35c264c54f5769396c0a2f959647bad3f1..50a1cd7f445b4a627b1991adf8595863cf053b95 100644 (file)
@@ -1148,7 +1148,10 @@ var KeyboardManager = class KeyBoardManager {
         const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
         const bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
         bottomDragAction.connect('activated', () => {
-            this.open(Main.layoutManager.bottomIndex);
+            this._keyboard.gestureActivate(Main.layoutManager.bottomIndex);
+        });
+        bottomDragAction.connect('progress', (_action, progress) => {
+            this._keyboard.gestureProgress(progress);
         });
         global.stage.add_action(bottomDragAction);
         this._bottomDragAction = bottomDragAction;
@@ -1725,7 +1728,7 @@ var Keyboard = GObject.registerClass({
         this._keyboardRestingId = 0;
     }
 
-    open() {
+    open(immediate = false) {
         this._clearShowIdle();
         this._keyboardRequested = true;
 
@@ -1734,6 +1737,11 @@ var Keyboard = GObject.registerClass({
             return;
         }
 
+        if (immediate) {
+            this._open();
+            return;
+        }
+
         this._clearKeyboardRestTimer();
         this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
             KEYBOARD_REST_TIME,
@@ -1835,6 +1843,21 @@ var Keyboard = GObject.registerClass({
         Main.layoutManager.keyboardBox.hide();
     }
 
+    gestureProgress(delta) {
+        Main.layoutManager.keyboardBox.show();
+        let progress = Math.min(delta, this.height) / this.height;
+        this.translation_y = -this.height * progress;
+        this.opacity = 255 * progress;
+        if (this._focusWindow) {
+            const windowActor = this._focusWindow.get_compositor_private();
+            windowActor.translation_y = -this.height * progress;
+        }
+    }
+
+    gestureActivate() {
+        this.open(true);
+    }
+
     resetSuggestions() {
         if (this._suggestions)
             this._suggestions.clear();